﻿using OpenTK;

namespace Chimp.Core.PostFX
{
    public class PostFX_CinematicBloom : ChimpPostFX
    {
        public float BloomScale = 24.0f;
        public float BlurRadius = 0.002f;
        public float MinLevel = 0.2f;

        public PostFX_CinematicBloom()
        {
            Effect = new ChimpEffect(null, "Res/Shader/PostFX_CinematicBloom.glsl");
            Effect.SetInt("SourceMap", 0);
        }

        public override void OnDrawPostFX(ChimpTexture2D src)
        {
            Effect.Use();
            Effect.SetFloat("MinLevel", MinLevel);
            Effect.SetFloat("BlurRadius", BlurRadius);
            Effect.SetFloat("BloomScale", BloomScale);
            ChimpDraw.BlendMode = ChimpBlend.Alpha;


            ChimpDraw.Image(new Vector4(0, 0, ChimpApp.W, ChimpApp.H), src, new Vector4(1, 1, 1, 1));

            Effect.Fin();
        }
    }
}